function jump2(n: number): number {

  // 定义状态
  // const dp: number[] = [];

  // 更改状态
  // dp[i] = dp[i-1] + dp[i-2]

  // 初始值
  if(n<=2){
    return n
  }

  let prev = 1
  let cur = 2


  // 循环状态转移
  for(let i= 3; i <= n; i++){
    const newValue = prev + cur
    prev = cur
    cur = newValue
  }
  
  return cur

}

console.log(jump2(5));
